﻿
<link href="~/Assets/css/jquery-ui-1.10.3.custom.min.css" rel="stylesheet" />
<link href="~/Assets/css/tagmanager.css" rel="stylesheet" />
<link href="~/Assets/css/typeahead.css" rel="stylesheet" />
<script src="~/Assets/js/jquery.form.js"></script>
<script src="~/assets/js/jquery.validate.min.js"></script>
<script src="~/Assets/js/typeahead.bundle.js"></script>
<script src="~/Assets/js/flexflow-controls.js"></script>
<script src="~/Assets/js/tagmanager.js"></script>
<script src="~/Assets/js/handlebars.js"></script>

<div class="row">
    <div class="form-horizontal" role="form" id="frmNodeEditor">
        <div class="form-group">
            <label class="col-sm-3 control-label no-padding-right" for="tag">名称:</label>
            <div class="col-sm-9">
                <input type="text" readonly="readonly" id="name" name="name" class="col-xs-12 col-sm-9">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label no-padding-right">审批人员：</label>
            <div class="col-sm-9">
                <input type="text" autocomplete="off" id="operatorSelector" placeholder="请输入姓名" style="width:9em;" class="input-medium tm-input tm-input-success tm-input-typeahead" data-type="user" data-original-title="" />
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label no-padding-right" for="tag">需要审批意见：</label>
            <div class="col-sm-9">
                <label>
                    <input type="checkbox"
                           id="@FlexFlow.Model.SystemTaskDataKey.NeedSignOption"
                           name="@FlexFlow.Model.SystemTaskDataKey.NeedSignOption"
                           class="ace ace-switch ace-switch-4" />
                    <span class="lbl"></span>
                </label>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label no-padding-right" 
                   for="taskFormSelector">任务表单:</label>
            <div class="col-sm-9">
                <input type="text" style="width:9em;"
                       id="taskFormSelector"
                       name="taskFormSelector"
                       placeholder="表单模板"
                       class="input-medium tm-input tm-input-success tm-input-typeahead">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label no-padding-right" for="tag">附加审批按钮：</label>
            <div class="col-sm-9">
                <input type="text" id="@FlexFlow.Model.SystemTaskDataKey.ExtendButton" name="@FlexFlow.Model.SystemTaskDataKey.ExtendButton" placeholder="附加按钮（以,隔开）" class="col-xs-12 col-sm-9">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label no-padding-right" for="tag">备注：</label>
            <div class="col-sm-9">
                <input type="text" id="tag" name="tag" placeholder="备注" class="col-xs-12 col-sm-9">
            </div>
        </div>
    </div>
</div>
<script>
    function initForm() {
        $("#name").val(selNode.name);
        $("#tag").val(selNode.opt.tag);
        $("#@FlexFlow.Model.SystemTaskDataKey.NeedSignOption").prop("checked", selNode.opt.@FlexFlow.Model.SystemTaskDataKey.NeedSignOption);
        initUserList("#operatorSelector", selNode.opt.operators, {
            hiddenTagListName: "operatorSelector"
        });
        initFormTemplateList("#taskFormSelector", selNode.opt.@FlexFlow.Model.SystemTaskDataKey.TaskFormId, {
            hiddenTagListName: "@FlexFlow.Model.SystemTaskDataKey.TaskFormId",
            maxTags: 1
        });
        $("#@FlexFlow.Model.SystemTaskDataKey.ExtendButton").val(selNode.opt.@FlexFlow.Model.SystemTaskDataKey.ExtendButton);
    }
    function saveForm() {
        selNode.opt.tag = $("#tag").val();
        selNode.opt.@FlexFlow.Model.SystemTaskDataKey.NeedSignOption = $("#@FlexFlow.Model.SystemTaskDataKey.NeedSignOption").prop("checked");
        selNode.opt.@FlexFlow.Model.SystemTaskDataKey.TaskFormId = $("[name = '@FlexFlow.Model.SystemTaskDataKey.TaskFormId']").val();
        selNode.opt.operators = $("[name = 'operatorSelector']").val();
        selNode.opt.@FlexFlow.Model.SystemTaskDataKey.ExtendButton = $("#@FlexFlow.Model.SystemTaskDataKey.ExtendButton").val();
    }
    initForm();
</script>